<?php
class connect {
	 var $res;

   function __construct($db_name)
   {
   		$hostname="localhost";
   		$username="root";
		$password="18A5pq86";
		mysql_connect($hostname, $username, $password) or die ("не могу создать соединение");
		mysql_select_db("u267869592_".$db_name) or die (mysql_error());
		mysql_query("set character_set_client='utf-8'");
		mysql_query("set character_set_results='utf-8'");
		mysql_query("set collation_connection='utf8_general_ci'");
   }
   function select_all($table, $condition="")
   {
   		$query="SELECT * FROM $table $condition";
   		//echo $query;
   		$this->res=mysql_query($query) or die(mysql_error());
   		return $this->res;
   }
   function select($table, $select, $condition)
   {
   		$query="SELECT $select FROM $table $condition";
   		$this->res=mysql_query($query) or die(mysql_error());
   }
   function insert_data($table, $data)
   {
   		$query="INSERT INTO $table SET $data";
   		//echo $query;
   		mysql_query($query) or die(mysql_error());
   }
   function update_data($table, $data, $condition)
   {
   		$query="UPDATE $table SET $data $condition";
   		//echo $query;
   		mysql_query($query) or die(mysql_error());
   }

  }
?>